<#include "../public/header.html">
    <div id="editdlg">
    </div>
    <div id="editdlg_windows">
    </div>
    <div id="editdlg_student">
    </div>
    <div id="import_file">
    </div>

    <div id="seach_view">
        <div style="padding:5px 5px; border-bottom: dashed #d2d2d2 1px;margin-bottom: 5px;">
            项目编号: <input class="easyui-textbox" style="width:110px" id="project_code">
            项目名称: <input class="easyui-textbox" style="width:110px" id="project_name">
            <a href="javascript://" class="easyui-linkbutton" iconCls="icon-search" onclick="search_but()">搜索</a>
        </div>
        <div id="mm_list" style="width:200px;">
            <div  onclick="print_student()">打印信息签名表</div>
            <div  onclick="print_pic()">打印图片确认</div>
            <div onclick="print_fz()">打印发证签名表</div>
        </div>
        <table cellspacing="0" cellpadding="0">
            <tbody>
            <tr>
                <td>
                    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="view_class_detail()"
                       data-options="iconCls:'icon-view',plain:'true',${((permission_button.p30201!) == 'true')? string('disabled:false','disabled:true')}" id="30201">查看</a>
                </td>
                <td>
                    <a href="javascript:void(0)" class="easyui-linkbutton"  onclick="up_to_check()"
                       data-options="iconCls:'icon-report-go',plain:'true',${((permission_button.p30205!) == 'true')? string('disabled:false','disabled:true')}" id="30205">提交资料审批</a>
                </td>
                <td>
                    <a href="javascript:void(0)" class="easyui-menubutton"
                       data-options="menu:'#mm_list',iconCls:'icon-prin',plain:'true',${((permission_button.p30207!) == 'true')? string('disabled:false','disabled:true')}" id="30207">打印</a>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <table id="list" title="项目信息" class="easyui-datagrid" style="width:100%;height:100%"
           sortName="id"
           sortOrder="asc"
           pagination="true"
           pagesize="50"
           singleSelect="true"
           rownumbers="true"
            >
    </table>


    <script type="text/javascript">

        $(function () {
            $("#seach_view").prependTo(".datagrid-toolbar");

            $("#list").datagrid({
                toolbar:'#seach_view',
                url: 'admin/project_class/list_teacher_Json',
                columns: [[
                    {field: 'class_name', title: '报考班级', width: 100, align: 'center'},
                    {field: 'project_code', title: '项目编号', width: 100, align: 'center'},
                    {field: 'project_name', title: '项目名称', width: 100, align: 'center'},
                    {field: 'project_rank_name', title: '项目级别', width: 100, align: 'center'},
                    {field: 'project_testing_money', title: '正考费用', width: 100, align: 'center'},
                    {field: 'project_theory_money', title: '单理论', width: 100, align: 'center'},
                    {field: 'project_reality_money', title: '单实操', width: 100, align: 'center'},
                    {field: 'project_other_money', title: '其他费用', width: 100, align: 'center'},
                    {field: 'project_register_num', title: '报考人数', width: 100, align: 'center'},
                    {field: 'project_testing_num', title: '正考人数', width: 100, align: 'center'},
                    {field: 'project_bk_theory_num', title: '补考理论人数', width: 100, align: 'center'},
                    {field: 'project_bk_reality_num', title: '补考实操人数', width: 100, align: 'center'},
                    {field: 'project_payment_num', title: '缴费人数', width: 100, align: 'center'},
                    {field: 'project_payment_money', title: '缴费总数', width: 100, align: 'center'},
                    {field: 'project_is_upload_info_name', title: '报考资料', width: 100, align: 'center'},
                    {field: 'project_payment_status_name', title: '缴费状态', width: 100, align: 'center'},
                    {field: 'project_card_status_name', title: '发证状态', width: 100, align: 'center'},
                    {field: 'status_name', title: '当前状态', width: 100, align: 'center',formatter:for_status},
                    {field: 'user_name', title: '创建用户', width: 100, align: 'center'},
                    {
                        field: 'create_time',
                        title: '创建时间',
                        width: 100,
                        align: 'center',
                        formatter: function (value, row, index) {
                            return formatDate(value);
                        }
                    }
                ]]
            });
        });

        function search_but() {
            $("#list").datagrid("reload", {
                project_name: $("#project_name").val(),
                project_code: $("#project_code").val()
            });
        }
        var view_class_detail = function () {
            var note =  $("#list").datagrid("getSelected");
            if(note == null){
                $.messager.show({
                    title:'提醒',
                    msg:'请选择要编缉的行',
                    showType:'fade',
                    style:{
                        right:'',
                        bottom:''
                    }
                });
                return;
            }

            $("#editdlg_windows").window({
                title: "班级报考",
                iconCls: 'icon-edit',
                width: '100%',
                height: '100%',
                closed: false,
                cache: false,
                modal: true,
                href: "admin/project_class/class_detail?project_class_id="+note.id,
                onLoad: function () {
                    $.messager.progress('close');
                }
            });
        }

        var up_to_check = function () {
            var note =  $("#list").datagrid("getSelected");
            if(note == null){
                $.messager.show({
                    title:'提醒',
                    msg:'请选择要编缉的行',
                    showType:'fade',
                    style:{
                        right:'',
                        bottom:''
                    }
                });
                return;
            }

            if(note.status !=248 && note.status != 250){
                $.messager.show({
                    title:'提醒',
                    msg:'当前状态不能提交',
                    showType:'fade',
                    style:{
                        right:'',
                        bottom:''
                    }
                });
                return;
            }


            if(note.project_payment_status != 321){
                $.messager.show({
                    title:'提醒',
                    msg:'未确认收费，不能提交',
                    showType:'fade',
                    style:{
                        right:'',
                        bottom:''
                    }
                });
                return;
            }

            $("#editdlg").dialog({
                title: "提交资料到学校",
                iconCls: 'icon-report-go',
                width: 650,
                height: 250,
                closed: false,
                cache: false,
                modal: true,
                href: "admin/project_examination/class_up_dep?project_class_id="+note.id+"&exa_type=291",
                onLoad: function () {
                    $.messager.progress('close');
                },
                buttons:[{
                    text: '取消',
                    iconCls:'icon-cancel',
                    handler: function () {
                        $("#editdlg").dialog("close");
                    }
                },{
                    text: '确定提交',
                    iconCls: 'icon-ok',
                    handler: function(){
                        $('#uptodepForm').form('submit',{
                            url:"admin/project_examination/save_class_up_dep",
                            dataType:"json",
                            onSubmit:function(){
                                return $(this).form('enableValidation').form('validate');
                            },
                            success:function(data){
                                var data = eval('(' + data + ')');  // change the JSON string to javascript object

                                $.messager.alert("提示",data.msg);
                                if(data.success==1){
                                    $("#editdlg").dialog("close");
                                    $("#list").datagrid("reload");
                                }
                            }
                        });
                    }
                }]
            });
        }

        var print_student = function () {
            var note =  $("#list").datagrid("getSelected");
            if(note == null){
                $.messager.show({
                    title:'提醒',
                    msg:'请选择要编缉的行',
                    showType:'fade',
                    style:{
                        right:'',
                        bottom:''
                    }
                });
                return;
            }

            $("#editdlg").dialog({
                title: "打印学生资料",
                iconCls: 'icon-prin',
                width: '100%',
                height: '100%',
                closed: false,
                cache: false,
                modal: true,
                href: "admin/project_class/print_student?project_class_id="+note.id,
                onLoad: function () {
                    $.messager.progress('close');
                },
                buttons:[{
                    text: '取消',
                    iconCls:'icon-cancel',
                    handler: function () {
                        $("#editdlg").dialog("close");
                    }
                },{
                    text: '打印',
                    iconCls: 'icon-prin',
                    handler: function(){
                        doPrint();
                    }
                }]
            });
        }

        var print_pic = function () {
            var note =  $("#list").datagrid("getSelected");
            if(note == null){
                $.messager.show({
                    title:'提醒',
                    msg:'请选择要编缉的行',
                    showType:'fade',
                    style:{
                        right:'',
                        bottom:''
                    }
                });
                return;
            }

            $("#editdlg").dialog({
                title: "打印学生图片",
                iconCls: 'icon-prin',
                width: '100%',
                height: '100%',
                closed: false,
                cache: false,
                modal: true,
                href: "admin/project_class/print_pic?project_class_id="+note.id,
                onLoad: function () {
                    $.messager.progress('close');
                },
                buttons:[{
                    text: '取消',
                    iconCls:'icon-cancel',
                    handler: function () {
                        $("#editdlg").dialog("close");
                    }
                },{
                    text: '打印',
                    iconCls: 'icon-prin',
                    handler: function(){
                        doPrint();
                    }
                }]
            });
        }

        var print_fz = function () {
            var note =  $("#list").datagrid("getSelected");
            if(note == null){
                $.messager.show({
                    title:'提醒',
                    msg:'请选择要编缉的行',
                    showType:'fade',
                    style:{
                        right:'',
                        bottom:''
                    }
                });
                return;
            }
            if(note.status != 262 && note.status != 263 && note.status != 264){
                $.messager.show({
                    title:'提醒',
                    msg:'当前状态不能打印',
                    showType:'fade',
                    style:{
                        right:'',
                        bottom:''
                    }
                });
                return;
            }

            $("#editdlg").dialog({
                title: "打印领证信息表",
                iconCls: 'icon-prin',
                width: '100%',
                height: '100%',
                closed: false,
                cache: false,
                modal: true,
                href: "admin/project_class/print_fz?project_class_id="+note.id,
                onLoad: function () {
                    $.messager.progress('close');
                },
                buttons:[{
                    text: '取消',
                    iconCls:'icon-cancel',
                    handler: function () {
                        $("#editdlg").dialog("close");
                    }
                },{
                    text: '打印',
                    iconCls: 'icon-prin',
                    handler: function(){
                        doPrint();
                    }
                }]
            });
        }

        function for_status(val,row){
            return "<a onclick='status_onclick("+row.project_id+","+row.class_id+",291)'>"+val+"</a>";
        }

        function status_onclick(project_id,class_id,type){
            $.messager.progress({
                text:'数据加载中....',
                interval:100
            });

            $("#editdlg").dialog({
                title:"查询状态记录",
                iconCls: 'icon-edit',
                width: 700,
                height: 400,
                closed: false,
                cache: false,
                modal: true,
                href:"admin/project_examination/project_record?project_id="+project_id+"&exa_type="+type+"&class_id="+class_id,
                onLoad:function() {
                    $.messager.progress('close');
                },
                buttons: []
            });
        }
    </script>
    <#include "../public/footer.html">